package web.fabrimind.mwm.service.impl;

import java.util.List;
import web.fabrimind.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import web.fabrimind.mwm.mapper.MaterialOutboundMapper;
import web.fabrimind.mwm.domain.MaterialOutbound;
import web.fabrimind.mwm.service.IMaterialOutboundService;

/**
 * 物料出库Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-26
 */
@Service
public class MaterialOutboundServiceImpl implements IMaterialOutboundService 
{
    @Autowired
    private MaterialOutboundMapper materialOutboundMapper;

    /**
     * 查询物料出库
     * 
     * @param outboundId 物料出库主键
     * @return 物料出库
     */
    @Override
    public MaterialOutbound selectMaterialOutboundByOutboundId(Long outboundId)
    {
        return materialOutboundMapper.selectMaterialOutboundByOutboundId(outboundId);
    }

    /**
     * 查询物料出库列表
     * 
     * @param materialOutbound 物料出库
     * @return 物料出库
     */
    @Override
    public List<MaterialOutbound> selectMaterialOutboundList(MaterialOutbound materialOutbound)
    {
        return materialOutboundMapper.selectMaterialOutboundList(materialOutbound);
    }

    /**
     * 新增物料出库
     * 
     * @param materialOutbound 物料出库
     * @return 结果
     */
    @Override
    public int insertMaterialOutbound(MaterialOutbound materialOutbound)
    {
        materialOutbound.setCreateTime(DateUtils.getNowDate());
        return materialOutboundMapper.insertMaterialOutbound(materialOutbound);
    }

    /**
     * 修改物料出库
     * 
     * @param materialOutbound 物料出库
     * @return 结果
     */
    @Override
    public int updateMaterialOutbound(MaterialOutbound materialOutbound)
    {
        materialOutbound.setUpdateTime(DateUtils.getNowDate());
        return materialOutboundMapper.updateMaterialOutbound(materialOutbound);
    }

    /**
     * 批量删除物料出库
     * 
     * @param outboundIds 需要删除的物料出库主键
     * @return 结果
     */
    @Override
    public int deleteMaterialOutboundByOutboundIds(Long[] outboundIds)
    {
        return materialOutboundMapper.deleteMaterialOutboundByOutboundIds(outboundIds);
    }

    /**
     * 删除物料出库信息
     * 
     * @param outboundId 物料出库主键
     * @return 结果
     */
    @Override
    public int deleteMaterialOutboundByOutboundId(Long outboundId)
    {
        return materialOutboundMapper.deleteMaterialOutboundByOutboundId(outboundId);
    }
}
